ResolveAliasFile
wasAliased);
FSSpec *theSpec ; pointer to a file system specification record Boolean resolvedAliasChains ; TRUE = resolve all aliases in a chain returns file specifications only in the form of file system specification records
defined by the FSSpec data type. The file system specification record represents a simple and complete description of a file system object. It
contains a volume reference number, a parent directory ID, and a name. Use
the File Manager function MakeFSSpec to convert other forms of file identification, such as full pathnames, into file system specifications.
You specify the file or directory you plan to open by passing a file system
name and location of the target file in theSpec.
defined for the system, to the ultimate target. Set the resolveAliasChains
chain, stopping only when it reaches the target file. Set it to FALSE if you want to resolve only one alias file, even if the target is another alias file.
The parameters targetIsFolder and wasAliased are return parameters only.
targetIsFolder to TRUE if the parameter theSpec points to a directory or a volume. It sets wasAliased to TRUE if the file originally passed in the parameter theSpec points to an alias file.
specified in theSpec to determine whether it is an alias and whether it is a file
un changed, sets the targetIsFolder parameter to TRUE for a directory or volume and FALSE for a file, sets wasAliased to FALSE, and returns noErr. If parameter theSpec, and sets the wasAliased flag to TRUE.
returns a result code of fnfErr and fills in the parameter theSpec with a
complete file system specification record describing the target (that is, the
volume reference number, parent directory ID, and filename or folder name).
The file system specification record is valid, although the object it describes
does not exist. This information is intended as a “hint” that lets you explore
possible solutions to the resolution failure. You can, for example, use the file
system specification record to create a replacement for a missing file with the
leaves the input parameters as they are and exits, returning the error code. In
Note: When opening a file without going through the Finder or the before opening the file. In the following code example, the customized open
function, MyOpen, ensures that the file to be opened is the target file, and
then opens the data fork with the FSpOpenDF function. Returns: an Error code. It will be one of the following:
nsvErr (-35) Volume not found
fnfErr (-43 Target not found, but volume and parent directory
found, and theSpec parameter contains a valid file
system specification record
dirNFErr (-120) Parent directory not found
// Assuming inclusion of
#include <Aliases.h>
OSErr MyOpen (FSSpec *theSpec, char perm, short * fRefNum) {
*fRefNum = -1; // initialize fRefNum
&wasAliased);
if ( targetIsFolder)
myErr = paramErr; // cannot open a folder
else
if (myErr) // try to open it
return myErr;
}